﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.guide.actions {
    import flash.display.*;
    import Modules.guide.*;

    public class GADisplayMask extends GuideAction {

        private var m_level:int = 0;
        private var m_parent:DisplayObjectContainer = null;
        private var m_alpha:Number = 0;

        override public function createFromXml(_arg1:XML):Boolean{
            var _local6:DisplayObject;
            var _local2:XMLList = checkAndGetElement(_arg1, "mask");
            if (!_local2){
                return (false);
            };
            var _local3:String = _local2.@level;
            var _local4:String = _local2.@parent;
            var _local5:String = _local2.@alpha;
            if (_local3.length > 0){
                switch (_local3){
                    case "game":
                        this.m_level = GuideConstants.MASK_GAME;
                        break;
                    case "bottombar":
                        this.m_level = GuideConstants.MASK_GAME_AND_BOTTOMBAR;
                        break;
                    case "all":
                        this.m_level = GuideConstants.MASK_ALL_UI;
                        break;
                    case "specific":
                        this.m_level = GuideConstants.MASK_SPECIFIC;
                        break;
                };
            };
            if (_local4.length > 0){
                if (_local4.toLowerCase() == "ui"){
                    this.m_parent = null;
                } else {
                    _local6 = m_guide.getObjectByName(_local4);
                    if (_local6 == null){
                        return (false);
                    };
                    this.m_parent = (_local6 as DisplayObjectContainer);
                };
            };
            if (_local5.length > 0){
                this.m_alpha = parseFloat(_local5);
            };
            return (true);
        }
        override public function enter():void{
            if (this.m_parent != null){
                m_guide.displayMaskWithParent(this.m_parent);
            } else {
                m_guide.displayMaskUI(this.m_level, this.m_alpha);
            };
            super.enter();
        }
        override public function update(_arg1:Number):void{
            super.update(_arg1);
            super.removeState(this);
        }

    }
}//package Modules.guide.actions 
